From c068633ee34875183befc6e0f37ab057cf77b34b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 8 Apr 2025 11:10:47 +0200 Subject: [PATCH] [PATCH] controls: Improve calculation of InlineMessage implicit height If the text isn't long enough to wrap into mulitple lines, but we have many or large actions such that the actions are still put below the text, the actions and close button would overlap because the close button is not accounted for. To fix that, always anchor the actions at the bottom and calculate a more proper implicit height for the entire inline message that accounts for close button height if it is visible. Gbp-Pq: Name upstream_2c6cd90f_controls-Improve-calculation-of-InlineMessage-implicit-height.patch --- src/controls/templates/InlineMessage.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controls/templates/InlineMessage.qml b/src/controls/templates/InlineMessage.qml index ecf3b66..f8a8688 100644 --- a/src/controls/templates/InlineMessage.qml +++ b/src/controls/templates/InlineMessage.qml @@ -207,10 +207,11 @@ T.Control { } implicitHeight: { + let maximumTopHeight = Math.max(label.implicitHeight, icon.implicitHeight, (root.showCloseButton ? closeButton.implicitHeight : 0)) if (atBottom) { - return label.implicitHeight + actionsLayout.implicitHeight + actionsLayout.anchors.topMargin + return maximumTopHeight + actionsLayout.implicitHeight + Kirigami.Units.smallSpacing } else { - return Math.max(icon.implicitHeight, label.implicitHeight, closeButton.implicitHeight, actionsLayout.implicitHeight) + return Math.max(maximumTopHeight, actionsLayout.implicitHeight) } } @@ -354,8 +355,7 @@ T.Control { alignment: Qt.AlignRight anchors { - top: contentLayout.atBottom ? label.bottom : parent.top - topMargin: contentLayout.atBottom ? Kirigami.Units.largeSpacing : 0 + bottom: parent.bottom right: (!contentLayout.atBottom && root.showCloseButton) ? closeButton.left : parent.right rightMargin: !contentLayout.atBottom && root.showCloseButton ? Kirigami.Units.smallSpacing : 0 } -- 2.30.2